#!/bin/bash


DIRECTORIES=${*}
i=0

for directory in $DIRECTORIES
do
  #echo "Processing directory $directory"
  for file in `ls $directory`
  do
    #echo "Processing file $directory/$file"
    num_words=`wc $directory/$file | awk '{print $2}'`
    #echo $num_words
    echo "$i    $file    $num_words    ${directory##*/}"
    i=`expr $i + 1`
  done
done
